package com.yili.oa.dao;

import com.yili.oa.models.UserRecharge;
import com.yili.oa.models.UserRechargeExample;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.DeleteProvider;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.InsertProvider;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectProvider;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.annotations.UpdateProvider;
import org.apache.ibatis.type.JdbcType;

public interface UserRechargeMapper {
    @SelectProvider(type=UserRechargeSqlProvider.class, method="countByExample")
    long countByExample(UserRechargeExample example);

    @DeleteProvider(type=UserRechargeSqlProvider.class, method="deleteByExample")
    int deleteByExample(UserRechargeExample example);

    @Delete({
        "delete from ft_user_recharge",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int deleteByPrimaryKey(Long id);

    @Insert({
        "insert into ft_user_recharge (id, order_id, ",
        "user_id, recharge_num, ",
        "recharge_channel, recharge_type, ",
        "time, status)",
        "values (#{id,jdbcType=BIGINT}, #{orderId,jdbcType=VARCHAR}, ",
        "#{userId,jdbcType=VARCHAR}, #{rechargeNum,jdbcType=INTEGER}, ",
        "#{rechargeChannel,jdbcType=VARCHAR}, #{rechargeType,jdbcType=VARCHAR}, ",
        "#{time,jdbcType=BIGINT}, #{status,jdbcType=INTEGER})"
    })
    int insert(UserRecharge record);

    @InsertProvider(type=UserRechargeSqlProvider.class, method="insertSelective")
    int insertSelective(UserRecharge record);

    @SelectProvider(type=UserRechargeSqlProvider.class, method="selectByExample")
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="recharge_num", property="rechargeNum", jdbcType=JdbcType.INTEGER),
        @Result(column="recharge_channel", property="rechargeChannel", jdbcType=JdbcType.VARCHAR),
        @Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.VARCHAR),
        @Result(column="time", property="time", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    List<UserRecharge> selectByExample(UserRechargeExample example);

    @Select({
        "select",
        "id, order_id, user_id, recharge_num, recharge_channel, recharge_type, time, ",
        "status",
        "from ft_user_recharge",
        "where id = #{id,jdbcType=BIGINT}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.BIGINT, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.VARCHAR),
        @Result(column="user_id", property="userId", jdbcType=JdbcType.VARCHAR),
        @Result(column="recharge_num", property="rechargeNum", jdbcType=JdbcType.INTEGER),
        @Result(column="recharge_channel", property="rechargeChannel", jdbcType=JdbcType.VARCHAR),
        @Result(column="recharge_type", property="rechargeType", jdbcType=JdbcType.VARCHAR),
        @Result(column="time", property="time", jdbcType=JdbcType.BIGINT),
        @Result(column="status", property="status", jdbcType=JdbcType.INTEGER)
    })
    UserRecharge selectByPrimaryKey(Long id);

    @UpdateProvider(type=UserRechargeSqlProvider.class, method="updateByExampleSelective")
    int updateByExampleSelective(@Param("record") UserRecharge record, @Param("example") UserRechargeExample example);

    @UpdateProvider(type=UserRechargeSqlProvider.class, method="updateByExample")
    int updateByExample(@Param("record") UserRecharge record, @Param("example") UserRechargeExample example);

    @UpdateProvider(type=UserRechargeSqlProvider.class, method="updateByPrimaryKeySelective")
    int updateByPrimaryKeySelective(UserRecharge record);

    @Update({
        "update ft_user_recharge",
        "set order_id = #{orderId,jdbcType=VARCHAR},",
          "user_id = #{userId,jdbcType=VARCHAR},",
          "recharge_num = #{rechargeNum,jdbcType=INTEGER},",
          "recharge_channel = #{rechargeChannel,jdbcType=VARCHAR},",
          "recharge_type = #{rechargeType,jdbcType=VARCHAR},",
          "time = #{time,jdbcType=BIGINT},",
          "status = #{status,jdbcType=INTEGER}",
        "where id = #{id,jdbcType=BIGINT}"
    })
    int updateByPrimaryKey(UserRecharge record);
}